// 导入request.js请求工具
import request from '@/utils/request.js';

// 获取活动成果列表
export const getOutcomes = (params) => {
    return request({
      url: '/admins/activityOutcomes/getOutcomes',
      method: 'get',
      params
    })
}

// 删除活动成果
export const deleteOutcome = (oid) => {
    return request({
      url: `/admins/activityOutcomes/delete/${oid}`,
      method: 'delete',
    })
}

// 获取活动成果详情
export const getOutcomeDetail = (oid) => {
    return request({
      url: `/admins/activityOutcomes/getOutcome/${oid}`,
      method: 'get',
    })
}

// 导出活动成果数据
export function exportOutcomes(sortType, startDate, endDate, searchText) {
    const params = new URLSearchParams({
        sortType: sortType || 'asc',
        startDate: startDate || '',
        endDate: endDate || '',
        searchText: searchText || ''
    }).toString();

    return request({
        url: `/admins/activityOutcomes/exportOutcomes?${params}`,
        method: 'get',
        responseType: 'blob',
        timeout: 60000,
        headers: {
            'Accept': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
        }
    });
}

